FROM golang:alpine as builder

RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories

RUN apk add --no-cache go

WORKDIR /build/missevan/

COPY . .

ENV GO111MODULE=on \
    GOPROXY=https://goproxy.cn,direct

RUN go build -ldflags "-s -w" -o missevan-bot cmd/main.go

FROM alpine:latest as prod

WORKDIR /app/missevan/

COPY --from=0 /build/missevan/missevan-bot .

CMD ./missevan-bot